<template>
	<section style="width:100%">
		<section>
			<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
				<el-form :inline="true">
					<el-form-item>
						<el-input v-model="roomId" placeholder="房间ID"></el-input>
					</el-form-item>
					<el-form-item>
						<el-button type="primary" v-on:click="getRoom(pageSize)">查询</el-button>
					</el-form-item>
				</el-form>
				<el-form :inline="true">
					<el-form-item label="明税总税收">
						<label>{{roomTotal.tax | division}}</label>
					</el-form-item>
					<el-form-item label="当日总税收">
						<label>{{roomTotal.todaytax | division}}</label>
					</el-form-item>
				</el-form>
			</el-col>
			<!--列表-->
			<el-table :data="roomList" highlight-current-row v-loading="listLoading" style="width: 100%;" :default-sort = "{prop: 'id'}">
				<el-table-column prop="id" label="房间ID" width="100" sortable>
				</el-table-column>
				<el-table-column prop="title" label="房间名称" width="300">
				</el-table-column>
				<!--<el-table-column prop="winlose" label="总输赢" width="150" sortable>-->
					<!--<template slot-scope="scope">-->
						<!--<span>{{scope.row.winlose | division}}</span>-->
					<!--</template>-->
				<!--</el-table-column>-->
				<!--<el-table-column prop="todaywinlose" label="当日输赢" width="150">-->
					<!--<template slot-scope="scope">-->
						<!--<span>{{scope.row.todaywinlose | division}}</span>-->
					<!--</template>-->
				<!--</el-table-column>-->
				<el-table-column prop="tax" label="明税总税收" width="200">
					<template slot-scope="scope">
						<span>{{scope.row.tax | division}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="todaytax" label="当日明税收" min-width="150">
					<template slot-scope="scope">
						<span>{{scope.row.todaytax | division}}</span>
					</template>
				</el-table-column>
			</el-table>

			<!--工具条-->
			<el-col :span="24" class="toolbar">
				<el-pagination layout="sizes, total, prev, pager, next" :page-sizes="[15, 30, 50]" @current-change="handleCurrentChange" @size-change="handleSizeChange"  :page-size="pageSize" :total="total" style="float:right;">
				</el-pagination>
			</el-col>

		</section>
	</section>
</template>

<script>
    import echarts from 'echarts'

	export default {
		data() {
			return {
			    roomTotal:{
                    darktax:'',
                    outratio:'',
                    todayeat:'',
                    todayout:'',
                    todaywinlose:'',
                    value:'',
                    winlose:''
				},
                roomList:[],
                roomId:'',
                value1:'',
                bloodTable:[],
                startDate:'',
				endDate:'',
                total:0,
                bloodTotal: 0,
                page:1,
                pageSize:15,
                bloodpage: 1,
                listLoading: false,
			}
		},
        created(){
			this.getRoom(this.pageSize)
        },
		methods:{
            handleSizeChange(val) {
                this.pageSize = val
                this.getRoom(this.pageSize);
            },
            handleCurrentChange(val) {
                this.page = val;
                this.getRoom(this.pageSize);
            },
            //获取房间列表
            getRoom(page) {
                this.listLoading = true;
                this.$axios.get('/game-tax-statistics?gameid='+this.roomId+'&index='+this.page+'&size='+page,{},this.global().token).then((res)=>{
                    this.listLoading = false;
                    if(res.status == 200){
                        this.total = res.data.count
                        this.roomTotal = res.data.statistics
                        let room = res.data.data
                        this.roomList = room
                    }else{
                        this.$message({message: res.data, type: 'error'});
                    }
                })
            },
		},
		mounted() {
			this.getRoom(this.pageSize);
		}
	}

</script>

<style scoped lang="stylus">
</style>